<template>
  <div>
    <pro-table
      ref="proTableInst"
      tableTitle="pro-table演示"
      :query="query"
      :queryProps="{
        labelWidth: 100
      }"
      :columns="columns"
      :request="fetchPageList"
      isExport
      auto-height
      noTotal
    ></pro-table>
  </div>
</template>

<script lang="ts" setup name="noTotal">
  import { logBigDataPage } from '@/api/system/log'
  import { useLogProTable } from './useLogProTable'
  import dayjs from 'dayjs'
  const getDate = () => {
    const endDate = dayjs().format('YYYY-MM-DD')
    const startDate = dayjs().subtract(1, 'month').format('YYYY-MM-DD')
    return {
      startDate,
      endDate
    }
  }
  const { columns, query } = useLogProTable({ getDate })
  async function fetchPageList(pageRequest, queryParams) {
    const timeData = getDate()

    const data = {
      pageRequest,
      ...queryParams
    }
    Object.assign(data, {
      startDate: timeData.startDate,
      endDate: timeData.endDate
    })
    const res = await logBigDataPage(data)
    if (res.code === '0000') {
      return {
        data: res.data?.content,
        preCount: res.data?.preCount,
        nextCount: res.data?.nextCount
      }
    }
  }
</script>

<style scoped></style>
